<?php

function post($key) {
    if (isset($_POST[$key]))
        return $_POST[$key];
    return false;
}

// setup the database connect
$cxn = mysql_connect('localhost', 'root', 'Mazda1428');
if (!$cxn)
    exit;
mysql_select_db('irgc', $cxn);

// check if we can get hold of the form field
if (!post('ID'))
    exit;

// let make sure we escape the data
$val = mysql_real_escape_string(post('ID'), $cxn);

// lets setup our insert query
//$sql = sprintf("INSERT INTO %s (column_name_goes_here) VALUES '%s';",
 //               'table_name_goes_here',
 //               $val
//);
$sql = "select * from game where id=8;";
$result = mysql_query($sql, $cxn);
//$row = mysql_fetch_row($result);
$row = mysql_fetch_array($result);
$test = $row['sequence'];
if ($test){
$test = $test.",".$val;
}
else {
$test = $val;
}
$sql1 = "update game set sequence='".$test."' where id=8;";
$result2 = mysql_query($sql1 , $cxn);
// lets run our query
//$result = mysql_query($sql, $cxn);

// setup our response "object"
$resp = new stdClass();
$resp->success = false;
if($result) {
    $resp->success = true;
}

print json_encode($resp);
?>